/*
 * @Author: your name
 * @Date: 2021-02-24 09:26:12
 * @LastEditTime: 2021-02-24 10:35:56
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \myproject\src\api\comment.js
 */
import request from '@/utils/request.js'
export const getComments = (articleId, offset) => {
  return request({
    method: 'GET',
    url: '/v1_0/comments',
    params: {
      type: 'a', // a表示对文章的评论 ,c表示对评论的回复
      source: articleId,
      offset
    }
  })
}
export const addComment = (articleId, content) => {
  return request({
    method: 'POST',
    url: '/v1_0/comments',
    data: {
      target: articleId,
      content
    }
  })
}
export const addCommentLike = commentId => {
  return request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
      target: commentId
    }
  })
}
export const deleteCommentLike = commentId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/comment/likings/${commentId}`
  })
}
